<cfcomponent hint="I contain function to interact with users" output="false" extends="com.wikifusion.utils.audit">
	
	
	<cffunction name="init" output="false" returntype="any" hint="instantiates an object of this class" access="public">
		<cfargument name="datasourceOBJ" required="true" type="struct">
			
		<cfscript>
			this.dataSourceObj = {};
			this.dataSourceObj.dsn = arguments.datasourceOBJ.dsn;
			this.dataSourceObj.prefix = arguments.datasourceOBJ.tablePrefix;
			this.dataSourceObj.username = arguments.datasourceOBJ.username;
			this.dataSourceObj.password = arguments.datasourceOBJ.password;
			this.dataSourceObj.tablePrefix = arguments.datasourceOBJ.tablePrefix; 
			Super.init(datasourceOBJ=arguments.datasourceOBJ);	
			this.userVars = {};
			setVar('isAdmin', false);
			setVar('isAuthor', false);	
			return this;		
		</cfscript>			
	</cffunction>
	
	<cffunction name="setVar" output="false" returntype="boolean" hint="dynamically sets the variables " access="public">
		<cfargument name="varname" required="false" type="string">
		<cfargument name="varvalue" required="false" type="string">
		<cfargument name="qryOBJ" required="false" type="query">
		
		<cfif structkeyexists(arguments, "varname") and len(arguments.varname)>
			<cfset this.userVars[arguments.varname] = arguments.varvalue>
		<cfelseif isquery(arguments.qryOBJ)>		
			<cfloop array="#arguments.qryOBJ.GetColumnNames()#" index="i">
				<cfset this.userVars[i] = ARGUMENTS.qryOBJ[i]>
			</cfloop>
		</cfif>	
		
		<cfreturn true>
	</cffunction>
	
	<cffunction name="getVar" output="false" returntype="Any" hint="dynamically returns the variables" access="public">		
		<cfargument name="varname" required="true" type="string">
				
		<cfreturn this.userVars[arguments.varname]>
	</cffunction>
	
	<cffunction name="getVars" output="false" returntype="Any" hint="dynamically returns the variables" access="public">
	
		<cfreturn this.userVars>
	</cffunction>
	

</cfcomponent>